using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Data;
//using System.Drawing;
//using System.Text;
using System.Windows.Forms;
using MediaPortal.Configuration;

namespace MediaPortal.GUI.iPlayer
{
    public partial class ConfigForm : Form
    {
        public ConfigForm()
        {
            InitializeComponent();
        }


        private void btSave_Click(object sender, EventArgs e)
        {
            using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "iPlayer.xml")))
            {
                xmlwriter.SetValue("iPlayer", "doBBC", getBBC.Checked ? 1 : 0);
                xmlwriter.SetValue("iPlayer", "doITV", getITV.Checked ? 1 : 0);
                xmlwriter.SetValue("iPlayer", "doC4", getC4.Checked ? 1 : 0);
                xmlwriter.SetValue("iPlayer", "doFive", getFive.Checked ? 1 : 0);
            }
            this.Close();
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }



        private void ConfigForm_Load_1(object sender, EventArgs e)
        {
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "iPlayer.xml")))
            {
                getBBC.Checked = true;
                if (xmlreader.GetValueAsInt("iPlayer", "doBBC", 1) != 1)
                    getBBC.Checked = false;

                getITV.Checked = true;
                if (xmlreader.GetValueAsInt("iPlayer", "doITV", 1) != 1)
                    getITV.Checked = false;

                getC4.Checked = true;
                if (xmlreader.GetValueAsInt("iPlayer", "doC4", 1) != 1)
                    getC4.Checked = false;

                getFive.Checked = true;
                if (xmlreader.GetValueAsInt("iPlayer", "doFive", 1) != 1)
                    getFive.Checked = false;

            }
        }

    }
}